using System;
namespace ch.ethz.ssh2.log
{

    /// <summary> Logger - a very simple logger, mainly used during development.
    /// Is not based on log4j (to reduce external dependencies).
    /// However, if needed, something like log4j could easily be
    /// hooked in.
    /// 
    /// </summary>
    /// <author>  Christian Plattner
    /// </author>
    /// <version>  2.50, 03/15/10
    /// </version>

    public class Logger
    {
        public bool Enabled
        {
            get
            {
                return enabled;
            }

        }

        private System.String className;

        public static Logger getLogger(System.Type x)
        {
            return new Logger(x);
        }

        public Logger(System.Type x)
        {
            this.className = x.FullName;
        }

        public void log(int level, System.String message)
        {
            if ((enabled) && (level <= logLevel))
            {
                long now = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;

                lock (this)
                {
                    System.Console.Error.WriteLine(now + " : " + className + ": " + message);
                    // or send it to log4j or whatever...
                }
            }
        }
        private const bool enabled = false;
        private const int logLevel = 99;
    }
}